﻿@model Subfaculty.ViewModels.StudyPlanViewModel
@using Subfaculty.Helpers
<script type="text/javascript">
    $(document).ready(onDocumentReady);
    function onDocumentReady() {
        $("#curentDirection").change(onChangeDirection);
        $("#btn_create")
            .button()
            .click(function () {
                window.location = '@Url.Action("/Create/")' + '@Model.curentDirection.ToString()';
            });
    }
    function onChangeDirection() {
        window.location = '@Url.Action("/Index/")' + $("#curentDirection").val();
    }
</script>
<div id="subMenu">
    <span>Направление: @Html.DropDownList("curentDirection")
    </span><span id="btnCreate">
        <button type="button" id="btn_create">
            Создать новый элемент</button>
    </span>
</div>
<hr />
<table align="center">
@{        IList<String> titleList = new List<String>();
        titleList.Add("Дисциплина"); titleList.Add("Кафедра"); titleList.Add("Направление"); titleList.Add("Семестр");
        titleList.Add("Лекции"); titleList.Add("Лаб.работы"); titleList.Add("Практики"); titleList.Add("СРС");
        titleList.Add("Форма СРС"); titleList.Add("Форма контроля");        
}
    @Html.DisplayTitleForTable(titleList)
    @foreach (var item in Model.StudyPlanItems)
    {                    
        <tr>
            <td>@Html.DisplayFor(modelItem => item.Discipline.DisciplineTitle)
            </td>
            <td>@Html.DisplayFor(modelItem => item.Department.DepartmentTitle)
            </td>
            <td>@Html.DisplayFor(modelItem => item.Direction.DirectionTitle)
            </td>
            <td>@Html.DisplayFor(modelItem => item.Semestr)
            </td>
            <td>@Html.DisplayFor(modelItem => item.HoursLecture)
            </td>
            <td>@Html.DisplayFor(modelItem => item.HoursLaboratory)
            </td>
            <td>@Html.DisplayFor(modelItem => item.HoursPractice)
            </td>
            <td>@Html.DisplayFor(modelItem => item.HoursSRS)
            </td>
            <td>@Html.DisplayFor(modelItem => item.TypeSRS)
            </td>
            <td>@Html.DisplayFor(modelItem => item.ControlType)
            </td>
            <td>
                <div align="center">
                    <a href="/StudyPlan/Edit/@item.Id.ToString()">
                        <img src="../../../Content/icons/edit.png" alt="Редактировать" />
                    </a>
                </div>
            </td>
            <td>
                <div align="center">
                    <a href="/StudyPlan/Delete/@item.Id.ToString()">
                        <img src="../../../Content/icons/delete.png" alt="Удалить" />
                    </a>
                </div>
            </td>
        </tr>      
    }
</table>
